<div class="contain">
    <div class="path">
        <?php echo _LB_CURRENT_PATH ;
        	echo '<a href=" '. URL .'trang-chu"> ' . _LB_HOME_PATH . '</a> ' . _IMAGE_ARROR_PATH .
        		'<span class="page_current"> '. _LB_REGISTER_PATH . '</span>';
        ?>
    </div>
    <script type="text/javascript">
    	head.ready(function() {
			$( "#wedding_date" ).datepicker({
				dateFormat: 'dd/mm/yy',
			});
			$('.input').tipsy({trigger: 'focus', gravity: $.fn.tipsy.autoWE, fade: true});
		});

		function checkExsitsName ( type ){
			
			var account_name 			= $('#account_name');
			var account_email 			= $('#account_email');
			
			var str_arr = '';
			var error_msg = '';
			var object = '';

			if ( type == <?php echo ACCOUNT_CHECK_TYPE_NAME; ?> && account_name.val() != '' ){
				str_arr = { type: <?php echo ACCOUNT_CHECK_TYPE_NAME; ?>,account_name: account_name.val() };
				object = account_name;
				error_msg = '<?php echo _ERROR_MSG_ACCOUNT_NAME_DUPLICATE; ?>';
			}
			else if ( type == <?php echo ACCOUNT_CHECK_TYPE_EMAIL; ?> && account_email.val() != '' ){
				str_arr = { type: <?php echo ACCOUNT_CHECK_TYPE_EMAIL; ?>,account_email: account_email.val() };
				object = account_email;
				error_msg = '<?php echo _ERROR_MSG_ACCOUNT_EMAIL_DUPLICATE; ?>';
			}

			if ( str_arr != '' && callAjaxFunction( '<?php echo URL;?>?a=REGI&regi=C',str_arr ) ){
				object_error = object.parent().children(':last-child');
    			if ( object_error.hasClass('error') ){
    				object_error.fadeOut();
    				object_error.remove();
    			}
    			showErrorInline ( object , error_msg )
    			return false;
    		}
    		else{
    			
    			object_error = object.parent().children(':last-child');
    			if ( object_error.hasClass('error') ){
    				object_error.fadeOut();
    				object_error.remove();
    			}
    		}
    		return true;

		}
	
    	function validate(){
    		
    		var account_name 			= $('#account_name');
    		var account_pass 			= $('#account_pass');
    		var account_pass_retype 	= $('#account_pass_retype');
    		var account_email 			= $('#account_email');
    		var account_email_retype 	= $('#account_email_retype');
    		var bride_name 				= $('#bride_name');
    		var groom_name 				= $('#groom_name');
    		var wedding_date 			= $('#wedding_date');
            var wedding_location        = $('#wedding_location');
    		var recaptcha               = $('#recaptcha_response_field');
    		
    		if ( $('.error').length > 0 ){
    			input_object = $('.error').first().parent().children(':first-child');
    			focusObject(input_object);
    			return false;
    		}

    		if ( isEmptyTextBox( account_name ,'<?php echo _ERROR_MSG_ACCOUNT_NAME_NOT_EMPTY?>' ) ){
    			return false;
    		}

    		if ( !isValidUserName( account_name ,'<?php echo _ERROR_MSG_ACCOUNT_NAME_NOT_VALID?>' ) ){
    			return false;
    		}

    		if ( isEmptyTextBox( account_pass ,'<?php echo _ERROR_MSG_ACCOUNT_PASS_NOT_EMPTY?>' ) ){
    			return false;
    		}
    		if ( isEmptyTextBox( account_pass_retype ,'<?php echo _ERROR_MSG_ACCOUNT_PASS_NOT_EMPTY?>' ) ){
    			return false;
    		}
    		if ( account_pass.val() != account_pass_retype.val() ){
    			showError ( account_pass_retype , '<?php echo _ERROR_MSG_ACCOUNT_PASS_NOT_MATCH; ?>' );
    			return false;
    		}
    		if ( !isValidEmail( account_email ,'<?php echo _ERROR_MSG_ACCOUNT_EMAIL_NOT_VALID; ?>') ){
    			return false;	
    		}
    		if ( !isValidEmail( account_email_retype ,'<?php echo _ERROR_MSG_ACCOUNT_EMAIL_NOT_VALID; ?>') ){
    			return false;	
    		}
    		if ( account_email.val() != account_email_retype.val() ){
    			showError ( account_email_retype , '<?php echo _ERROR_MSG_ACCOUNT_EMAIL_NOT_MATCH; ?>' );
    			return false;	
    		}
    		if ( isEmptyTextBox( groom_name ,'<?php echo _ERROR_MSG_GROOM_NAME_NOT_EMPTY?>' ) ){
    			return false;
    		}
    		if ( isEmptyTextBox( bride_name ,'<?php echo _ERROR_MSG_BRIDE_NAME_NOT_EMPTY?>' ) ){
    			return false;
    		}
    		
            if ( isEmptyTextBox( recaptcha ,'<?php echo _ERROR_MSG_RECAPTCHA_NOT_EMPTY?>' ) ){
                return false;
            }

    		$('#frm_register').submit();
    	}
    </script>
    <span class="header"><?php echo _LB_CREATE_WEDDING_WEBSITE; ?></span>
    <form name="frm_register" id="frm_register" method="post" action="<?php echo URL;?>?a=REGI&regi=R">
    <div style="padding-left:20px">
        	<?php
    			if (isset($_SESSION['error_register']) && $_SESSION['error_register'])
    				echo '<div class="error">'.$_SESSION['error_register'].'</div>';
    		?>
            <div>
    	    	<div id="account_info">
    		    	<div class="title"><?php echo _LB_ACCOUNT_INFORMATION ?></div><br/>
    		    	<div class="left w200"><?php echo _LB_ACCOUNT_NAME . _LB_REQUIRED ?></div>
    		    	<div class="left">
    		    		<input title="<?php echo _INFO_ACCOUNT;?>" class="input" type="text" name="account_name" id="account_name" value="" onchange="checkExsitsName(<?php echo ACCOUNT_CHECK_TYPE_NAME; ?>)">
    		    	</div>	    	
    		    	<div class="clear">&nbsp;</div>

    		    	<div class="left w200"><?php echo _LB_ACCOUNT_PASS . _LB_REQUIRED ?></div>
    		    	<div class="left">
    		    		<input title="<?php echo _INFO_PASS;?>" class="input" type="password" name="account_pass" id="account_pass" value="">
    		    	</div>
    		    	<div class="clear">&nbsp;</div>

    		    	<div class="left w200"><?php echo _LB_ACCOUNT_PASS_RETYPE . _LB_REQUIRED ?></div>
    		    	<div class="left">
    		    		<input class="input" type="password" name="account_pass_retype" id="account_pass_retype" value="">
    		    	</div>
    		    	<div class="clear">&nbsp;</div>

    		    	<div class="left w200"><?php echo _LB_ACCOUNT_EMAIL . _LB_REQUIRED ?></div>
    		    	<div class="left">
    		    		<input title="<?php echo _INFO_MSG_EMAIL;?>" class="input" type="text" name="account_email" id="account_email" value="" onchange="checkExsitsName(<?php echo ACCOUNT_CHECK_TYPE_EMAIL; ?>)">
    		    	</div>
    		    	<div class="clear">&nbsp;</div>

    		    	<div class="left w200"><?php echo _LB_ACCOUNT_EMAIL_RETYPE . _LB_REQUIRED ?></div>
    		    	<div class="left">
    		    		<input class="input" type="text" name="account_email_retype" id="account_email_retype" value="">
    		    	</div>
    		    	<div class="clear">&nbsp;</div>
    		    </div>

    		    <div id="couple_info">
    		    	<div class="title"><?php echo _LB_COUPLE_INFORMATION ?></div><br/>
    		    	<div class="left w200"><?php echo _LB_GROOM_NAME . _LB_REQUIRED ?></div>
    		    	<div class="left">
    		    		<input class="input" type="text" name="groom_name" id="groom_name" value="">
    		    	</div>
    		    	<div class="clear">&nbsp;</div>

    		    	<div class="left w200"><?php echo _LB_BRIDE_NAME . _LB_REQUIRED ?></div>
    		    	<div class="left">
    		    		<input class="input" type="text" name="bride_name" id="bride_name" value="">
    		    	</div>
    		    	<div class="clear">&nbsp;</div>
    		    </div>

    		    <div id="wedding_info">
    		    	<div class="title"><?php echo _LB_WEDDING_INFORMATION ?></div><br/>
    		    	<div class="left w200"><?php echo _LB_WEDDING_DATE?></div>
    		    	<div class="left">
    		    		<input title="<?php echo _INFO_MSG_WEDDING_DATE; ?>" class="input" type="text" name="wedding_date" id="wedding_date" value="">
    		    	</div>
    		    	<div class="clear">&nbsp;</div>
    		    	
    		    	<div class="left w200"><?php echo _LB_WEDDING_LOCATION ?></div>
    		    	<div class="left">
    		    		<input class="input" type="text" name="wedding_location" id="wedding_location" value="">
    		    	</div>
    		    	<div class="clear">&nbsp;</div>
                </div>
                <div id="captcha">
                    <div class="title"><?php echo _LB_CAPTCHA ?></div><br/>
                    <div class="left w200">&nbsp;</div>
                    <div class="left">
                        <?php 
                            echo recaptcha_get_html(PUBLIC_KEY);
                        ?>
                    </div>
                    <div class="clear">&nbsp;</div>
                </div>
            </div>
        </form>
        <div class="buttons" align="center">
        	<button class="acction blue" onclick="validate();return false;">
        		<span class="label">&nbsp;&nbsp;&nbsp;Đăng ký&nbsp;&nbsp;&nbsp;</span>
        	</button>
        </div>
        
    </div>